import sys, random

# syntax: python random_tc.py <tests> <hosts>
# currently, hosts never change source port and src != dest

tests = int(sys.argv[1])
num_hosts = int(sys.argv[2])

hosts = []
for host_no in range(1,num_hosts+1):
	hosts.append(host_no)

case = ''
for i in range(tests):
	src = random.choice(hosts)
	src_port = random.randint(0,3)
	dest = random.choice(hosts)
	case += "%x %d %x\n"%(src,src_port,dest)
	
print case